Caption = "Use Ctrl-Up, Ctrl-Down, Ctrl-Right, Ctrl-Left to Scroll."
Height = 495
Left = 1200
TabIndex = 13
Top = 420
Width = 2655
End
End
DefInt A-Z
'Grid Scrolling And Control Program
'Copyright 1991 Nelson Ford, Public (software) Library
'For documentation and copyright license,
' see the file Grid.Bas
'The code in this module which allows overlapping controls
'was developed by Keith Funk
Declare Function ControlhWnd Lib "ctlhwnd.dll" (Ctl As Control) As Integer
Declare Function GetFocus Lib "User" ()
Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
Declare Function GetNextWindow Lib "User" (ByVal hWnd As Integer, ByVal wFlag As Integer) As Integer
Declare Function GetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
Declare Function SetWindowLong Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Long) As Long
Const WS_CLIPSIBLINGS = &H4000000
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const GW_HWNDNEXT = 2
Const GW_CHILD = 5
Const GWL_STYLE = (-16)
Sub Command1_Click (Index As Integer)
Select Case Index
Case 0
DelRow Grid1
Case 1
InsertRow Grid1
Case 2
ClearGrid Grid1
Case 3
Grid2Clip Grid1
Case 4
SaveGrid Grid1, "GridTest", Cancel
Case 5
LoadGrid Grid1, "GridTest"
Case 6
End
End Select
'keep the Grid highlight under the Text box:
Grid1.SelStartCol = Grid1.Col
Grid1.SelEndCol = Grid1.Col
Grid1.SelStartRow = Grid1.row
Grid1.SelEndRow = Grid1.row
Text1.SetFocus
End Sub
Sub Form_Load ()
Form1.Show
Call SetClipSiblingBit(Form1.hWnd)
'get hWnd for the controls:
Grid1.SetFocus
G = GetFocus()
Text1.SetFocus
t = GetFocus()
Call SetWindowPos(G, t, 0, 0, 0, 0, (SWP_NOSIZE Or SWP_NOMOVE))
Grid1.row = 0
Grid1.Col = 0
Text1.Top = Grid1.Top
Text1.Left = Grid1.Left
Text1.Width = Grid1.ColWidth + 20
Text1.Visible = -1
End Sub
Sub SetClipSiblingBit (ByVal hWndParent As Integer)